﻿using System.Web.Http;
using TeamsPortal.Web.Controllers.Formatters;

namespace TeamsPortal.Web.Output2.App_Start
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            config.Routes.MapHttpRoute(
                name: "RolesApiUsersInRole",
                routeTemplate: "api/Roles/{action}/{roleName}",
                defaults: new { Controller = "Roles", Action = "GetUsersInRole" }
            );
            config.Routes.MapHttpRoute(
                name: "ApiActionById",
                routeTemplate: "api/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );

            config.Formatters.Add(new UploadImageModelFormatter());
        }
    }
}
